#ifndef SIMPHYSICSOBJECT_H
#define SIMPHYSICSOBJECT_H

/* To generate primitive shapes using glut or manually
 * Can contain static functions for this - generates vertices, indices,
 * uv, normals
 */
//#include "SimShapeGenerator.h"

// Qt
#include <QVector>
#include <QVector3D>
#include <QMatrix4x4>

// Forward declarations
class QMatrix4x4;
class QOpenGLVertexArrayObject;
class QOpenGLBuffer;
enum ObjectType;
class btRigidBody;


/*
 * Represents a sim object. We can factor out some of this code
 * to a parent SimObject class or have this as an interface impl
 * TODO
 */
class SimPhysicsObject
{
public:
    SimPhysicsObject(ObjectType type);
    ~SimPhysicsObject();

    // Maybe called by simphysics
    QMatrix4x4 getModelMatrix(){}

    QMatrix4x4 getColor(){}

    /*
	 * Create the shape - this should call upon the SimShapeGenerator
	 */
	void createGeometry();

	/*
	 * Create the physics shape
	 */
	void createPhysics();

    /*
     * Bind OpenGL objects and render shape
     */
    virtual void render();

private:
    // ------- Physics ---------
    btRigidBody* mRigidBody;
    ObjectType mType;


    // ------- Rendering ----------
    // Dynamic to avoid including large headers and to use fwd decl.
    // these require destruction in dtor of this class
    QOpenGLVertexArrayObject *mVAO;

    // Vertices and indices
    QOpenGLBuffer *mVBO;
    QOpenGLBuffer *mIBO;

    // Colors - using a color uniform for entire frame may suffice
    //QVector3D mColor;
    // Store location of the color uniform when req for changing color arises

    // Not used for now - required later for lighting
    QOpenGLBuffer *mUVBO;
    QOpenGLBuffer *mNBO;

    QVector<QVector3D> mVertices;
    QVector<QVector3D> mIndices;

    //QVector<QVector3D> mNormals;
    //QVector<QVector3D> mColors;




};

#endif // SIMPHYSICSOBJECT_H
